package com.face.gaoml.netlibrary.widget;

import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.face.gaoml.netlibrary.App;
import com.gml.gao.netlibrary.R;


public class MsgAlert {

	private Toast msgToast;
	private TextView msgText;

	public MsgAlert() {
		View msgView = View.inflate(App.appApplication, R.layout.common_msgalert, null);
//				.inflate(R.layout.hb_msgalert, null);
		msgText = (TextView) msgView.findViewById(R.id.message);

		msgToast = new Toast(App.appApplication);
		msgToast.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 170);
		msgToast.setDuration(Toast.LENGTH_SHORT);
		msgToast.setView(msgView);
	}

	public void show(String msgStr) {
		if (msgStr != null && !"".equals(msgStr)) {
			msgText.setText(msgStr);
			msgToast.show();
		}
	}

	public void show(int msgId) {
		if (msgId != -1) {
			msgText.setText(msgId);
			msgToast.show();
		}
	}
}
